/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package enteties.article;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Joris
 */
@Entity
@Table(name = "eancode")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Eancode.findAll", query = "SELECT e FROM Eancode e"),
    @NamedQuery(name = "Eancode.findById", query = "SELECT e FROM Eancode e WHERE e.id = :id"),
    @NamedQuery(name = "Eancode.findByEancode", query = "SELECT e FROM Eancode e WHERE e.eancode = :eancode")})
public class Eancode implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Column(name = "eancode")
    private int eancode;
    @JoinColumn(name = "Article_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Article articleid;
    @JoinColumn(name = "Size_id", referencedColumnName = "id")
    @ManyToOne
    private Size1 sizeid;
    @JoinColumn(name = "Model_id", referencedColumnName = "id")
    @ManyToOne
    private Model modelid;

    public Eancode() {
    }

    public Eancode(Integer id) {
        this.id = id;
    }

    public Eancode(Integer id, int eancode) {
        this.id = id;
        this.eancode = eancode;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public int getEancode() {
        return eancode;
    }

    public void setEancode(int eancode) {
        this.eancode = eancode;
    }

    public Article getArticleid() {
        return articleid;
    }

    public void setArticleid(Article articleid) {
        this.articleid = articleid;
    }

    public Size1 getSizeid() {
        return sizeid;
    }

    public void setSizeid(Size1 sizeid) {
        this.sizeid = sizeid;
    }

    public Model getModelid() {
        return modelid;
    }

    public void setModelid(Model modelid) {
        this.modelid = modelid;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Eancode)) {
            return false;
        }
        Eancode other = (Eancode) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "enteties.article.Eancode[ id=" + id + " ]";
    }
    
}
